package jxust.isp4mn.daoImpl;

import java.util.List;

import javax.annotation.Resource;

import org.hibernate.SessionFactory;
import org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.stereotype.Component;

import jxust.isp4mn.dao.TestDao;
import jxust.isp4mn.model.TestModel;

@Component("testDao")
public class TestDaoImpl extends HibernateDaoSupport implements TestDao {
	
	
	private AnnotationSessionFactoryBean sessionFactory;
	
	public void add(TestModel test) {
		getHibernateTemplate().save(test);
	}

	public List<TestModel> findAll() {
		return (List<TestModel>)getHibernateTemplate().find("from test");
	}
	@Resource(name = "sessionFactory")
    public void setSuperSessionFactory(SessionFactory sessionFactory) {
        super.setSessionFactory(sessionFactory);
    }

	
}
